#!/usr/bin/python3
"""A handful utility to deal with prime numbers."""

import sys


def is_prime_number(n):
    """
    Determine if a natural number N is a prime number.
    """
    if n <= 1:
        return False
    if n % 2 == 0:
        return False if n > 2 else True

    m = int(n ** 0.5) + 1  # XXX: Incr m as m**2 <= n if m = [n ** 0.5]
    m = m if m % 2 == 0 else m + 1  # XXX: Enlarge m a bit if m is even
    for i in range(3, m, 2):
        if n % i == 0:
            return False
    return True


def main(argc, argv):
    if argc != 2:
        print(f"Usage: {argv[0]} <N>", file=sys.stderr)
        return 1

    n = int(argv[1])
    if not is_prime_number(n):
        print(f"Oops, {n} is not a prime number!")
        return 1

    print(f"Yes, {n} is a prime number.")
    return 0


if __name__ == '__main__':
    sys.exit(main(len(sys.argv), sys.argv))
